package com.ruoyi.web.controller.statistics.department;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.department.Statistics.AwardQueryParam;
import com.ruoyi.system.domain.department.Statistics.AwardReportDTO;
import com.ruoyi.system.domain.teacher.Statistics.TeacherStatisticsRequestVO;
import com.ruoyi.system.service.department.IDepartmentStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description:院系统计
 * @Author: 刘巍
 * @Date: 2020/3/16
 * @Version V1.0
 */
@RestController
@RequestMapping("/department/statistics")
public class DepartmentStatisticsController extends BaseController {
    @Autowired
    private IDepartmentStatisticsService service;

    /**
     * 获取院系各项信息
     * @return
     */
    @PostMapping("/indexInfo")
    public AjaxResult getIndexInfo(TeacherStatisticsRequestVO requestVO){
        Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
        requestVO.setDeptId(deptId+"");
        return   success(service.getIndexInfo(requestVO));
    }


    /**
     * 获奖报表
     * @param param
     * @return
     */
    @PostMapping("/generate")
    public AjaxResult generateReport(  AwardQueryParam param) {
        List<AwardReportDTO> report = service.generateReport(param);
        return success(report);
    }

}
